package com.weibo.berkeleydb;

import java.util.List;

/**
 * Created by zhangzhen on 2017/1/10.
 */
public class Pool<K> {

    private List<K> queue = null;

    public Pool() {
    }

    public Pool(List<K> queue) {
        this.queue = queue;
    }

    public void setQueue(List queue) {
        this.queue = queue;
    }

    public synchronized K get(){
        if (!queue.isEmpty())
            return queue.remove(0);
        return null;
    }
    public synchronized void add(K k){
        queue.add(k);
    }
}
